import axios from "axios"

const service = axios.create()

service.interceptors.request.use(function (config) {
  config.headers['token'] = sessionStorage.getItem('token') || ''
  return config
}, function (error) {
  return Promise.reject(error);
});

// 添加响应拦截器
service.interceptors.response.use(function (response) {
  return response.data;
}, function (error) {
  return Promise.reject(error);
});

export default service